﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="user.aspx.vb" Inherits="user" %>
<%@ Import Namespace="System.Xml" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>User Page</title>
</head>
<body>

<%
    
    Dim userLogin As String = Request.QueryString("login")
    Dim userPassword As String = Request.QueryString("password")
    Dim userEmail As String = Request.QueryString("email")
    Dim action As String = Request.QueryString("action")
    
    If action = "add" Then
    
        Dim xmlDoc As New XmlDocument()

        xmlDoc.Load(Server.MapPath("xml_users.xml"))

        Dim node As XmlNode = xmlDoc.DocumentElement
        Dim item As XmlElement = xmlDoc.CreateElement("item")
        'Dim name As XmlElement = xmlDoc.CreateElement("name")
    
        item.SetAttribute("login", userLogin)
        item.SetAttribute("password", userPassword)
        item.SetAttribute("name", "Unnamed")
        item.SetAttribute("surname", "User")
        item.SetAttribute("sex", "male")
        item.SetAttribute("email", userEmail)
        item.SetAttribute("role", "user")
        item.SetAttribute("wallpaper", "images/wallpapers/0.jpg")
   
        'sendMessage("v.marinchenko@77agency.com", "v.marinchenko@77agency.com", "v.marinchenko@77agency.com", "v.marinchenko@77agency.com")
        'SendMail("v.marinchenko@77agency.com", "v.marinchenko@77agency.com", "v.marinchenko@77agency.com", "v.marinchenko@77agency.com")
        'sitem.AppendChild(name)
    
        node.InsertAfter(item, node.FirstChild)
        Try
            xmlDoc.Save(Server.MapPath("xml_users.xml"))
            %>
            <script type="text/javascript">c = confirm("Jauns lietotājs tiek izveidotss");</script>
            <%
            Catch Exception As Exception
            %>
            <script type="text/javascript">alert('Sistēmas ķļuda!')</script>
            <%    
            End Try
    End If
    
%>


</body>
</html>
